package edu.suda.xsap.service.impl;

import edu.suda.xsap.dto.MemberBindRecordDto;
import edu.suda.xsap.dto.convert.MemberBindRecordConvert;
import edu.suda.xsap.entity.MemberBindRecord;
import edu.suda.xsap.mapper.MemberBindRecordMapper;
import edu.suda.xsap.service.MemberBindRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberBindRecordServiceImpl implements MemberBindRecordService {
    @Autowired
    private MemberBindRecordMapper memberBindRecordMapper;
    @Autowired
    private MemberBindRecordConvert memberBindRecordConvert;



    @Override
    public List<MemberBindRecordDto> findAll() {

        return memberBindRecordConvert.toDtoList(memberBindRecordMapper.findAll());
    }

    @Override
    public MemberBindRecordDto findById(Integer id) {
        return memberBindRecordConvert.toDto(memberBindRecordMapper.findById(id));
    }

    @Override
    public void save(MemberBindRecord memberBindRecord) {
        memberBindRecordMapper.save(memberBindRecord);
    }

    @Override
    public void update(MemberBindRecord memberBindRecord) {
        memberBindRecordMapper.update(memberBindRecord);
    }

    @Override
    public List<MemberBindRecordDto> findByMemberId(Integer memberId) {
        return memberBindRecordConvert.toDtoList(memberBindRecordMapper.findByMemberId(memberId));
    }
}
